package object;

public class IntegerDemo {
    public static void main(String[] args) {
        String s1 = "99";
        int num = Integer.parseInt(s1);
        System.out.println(num);

        String s2 = "65.022";
        double d = Double.parseDouble(s2);
        System.out.println(d);








        //演示包装类的常用操作:
        //1)可以通过包装被来获取基本类型的取值范围
       /* int max = Integer.MAX_VALUE;
        int min = Integer.MIN_VALUE;
        System.out.println(max);
        System.out.println(min);

        long max1 = Long.MAX_VALUE;
        long min1 = Long.MIN_VALUE;
        System.out.println(max1);
        System.out.println(min1);

        double max2 = Double.MAX_VALUE;
        double min2 = Double.MIN_VALUE;
        System.out.println(max2);
        System.out.println(min2);


        char max3 = Character.MAX_VALUE;
        char min3 = Character.MIN_VALUE;
        System.out.println(max3);
        System.out.println(min3);*/


        //触发了自动装箱特性,会被编译为:Integer i = Integer.valueOf(5) ;
        // Integer i = 5;//基本类型到包装类--------装箱

        //触发了自动插箱特性,会被编译为:int j = i.intValue();
//        int i1 = i;//包装类到基本类型------------拆箱




        /*Integer i1 = new Integer(5);
        Integer i2 = new Integer(5);
        System.out.println(i1 == i2);//false
        System.out.println(i1.equals(i2));//true

        Integer i3 = Integer.valueOf(500);
        Integer i4 = Integer.valueOf(500);
        System.out.println(i3 == i4);//false
        System.out.println(i3.equals(i4));//true
        Integer i5 = Integer.valueOf(5);
        Integer i6 = Integer.valueOf(5);
        System.out.println(i5 == i6);//true


        int i = i4.intValue();
        System.out.println(i);*/
    }
}
